package com.tc.service.impl;

import com.tc.R;
import com.tc.entity.Order_Commodity;
import com.tc.mapper.GoodsMapper;
import com.tc.service.GoodsService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * @Author: wangyifan
 * @Date: 2022/03/03 15:26
 * @Description: $end$
 * @Version: V1.0
 */

@Service
public class GoodsServiceImpl implements GoodsService {
    @Autowired(required = false)
    private GoodsMapper goodsMapper;

    @Override
    public R reduceGoods(Long goodsId,Integer goodsNumber) {
        R r  = new R();
        int result = goodsMapper.reduceGoods(goodsId,goodsNumber);
        if(result > 0){
            r.setCode(200);
            r.setMsg("减少商品库存成功");
            System.out.print("减少商品库存成功");
        }else {
            r.setCode(200);
            r.setMsg("减少商品库存失败");
            System.out.print("减少商品库存失败");
        }
        return r;
    }
}
